import Inject from "@entity-access/entity-access/dist/di/di.js"; import { Route } from "@entity-access/server-pages/dist/core/Route.js"; import Page from "@entity-access/server-pages/dist/Page.js"; import StorePaymentGatewayService from "../../../../../server/services/store/StorePaymentGatewayService.js"; import EncryptionService from "../../../../../server/services/encryption/EncryptionService.js"; import SocialMailContext from "../../../../../server/model/SocialMailContext.js"; export default class extends Page { @Route paymentID; @Inject pgs: StorePaymentGatewayService; @Inject ecs: EncryptionService; @Inject db: SocialMailContext; async run() { const { paymentID } = this; const attemptID = this.ecs.general.decrypt(paymentID) as any; const payment = await this.db.storePaymentAttempts.statements.select({}, { attemptID }); const c = await this.pgs.checkoutResult(payment); if (c.status) { this.cacheControl = "public, max-age=8600"; } return this.redirect("/store/order/" + c.orderID); } }